home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / EDITORS / PAR212.ZIP;1 / POMSAMPL.POM < prev    next >
Encoding:
Text File  |  1992-10-23  |  5.0 KB  |  158 lines

  1. ; ABOUT THIS FILE
  2. ; ---------------
  3. ;
  4. ; Null lines and lines starting with a semi-colon are ignored.
  5. ;
  6. ; NOTE:  A POM file may contain up to 500 lines of specifications.  Comment
  7. ;        lines do not count.
  8. ;
  9. ;
  10. ; PARSE-O-MATIC COMMAND LINE
  11. ; --------------------------
  12. ;
  13. ; POM pom-file input-file output-file
  14. ;
  15. ;
  16. ; COMMAND WORDS
  17. ; -------------
  18. ;
  19. ; MINLEN number
  20. ;   Specifies the minimum length a line must be to be considered for parsing.
  21. ;   (Note that null lines are always ignored)
  22. ;
  23. ; IGNORE value1 value2
  24. ;   When value1 contains value2, the line is ignored and all further processing
  25. ;   on the line stops.  The usual format of this command is something like:
  26. ;   IGNORE $FLINE[3 9] "Date"
  27. ;   This would skip any input line that contains the word "Date" between
  28. ;   columns 3 and 9 ($FLINE references the line just read).
  29. ;
  30. ; IF value1 value2 var1 value3 [value4]
  31. ;   If value1 matches value2, var1 is set to value3.  Otherwise, it is
  32. ;   set to value4.  If value4 is missing, nothing is done (i.e. var1
  33. ;   is not changed).
  34. ;
  35. ; OUT[END] value1 value2 |output-picture
  36. ;   This is two command words:  OUT and OUTEND.  OUT writes to the output
  37. ;   file without an end-of-line.  OUTEND writes an end-of-line to the file.
  38. ;   When value1 matches value2, a line is output to the output file,
  39. ;   according to the output picture.  Within the output picture, all
  40. ;   text is taken literally (i.e. " is taken to mean literally that --
  41. ;   a quotation mark character).  The only exception to this is that
  42. ;   variable names are identified by the { and } characters.  For
  43. ;   example, the line:  OUTEND "X" "X" |{$FLUPC}  would simply
  44. ;   output (in uppercase) every non-IGNOREd line in the input file.
  45. ;   NOTE:  OUT does not actually write to the output file; it accumulates the
  46. ;   output.  You must do an OUTEND to actually write the data.  The maximum
  47. ;   line length allowed is 255 characters.
  48. ;
  49. ; TRIM var1 spec1 character
  50. ;   Removes characters from var1.  This is usually used to remove blanks.
  51. ;   spec1 can be:  A=All  B=Both ends  L=Left side only  R = Right side only
  52. ;
  53. ; CHANGE var1 value1 value2
  54. ;   Replaces ALL occurances of value1 with value2
  55. ;
  56. ; TRACE var1
  57. ;   Reports the value of var1 in the trace file (POM.TRC) if tracing has been
  58. ;   enabled (with the DOS command SET POM=T).
  59. ;
  60. ;
  61. ; VALUES
  62. ; ------
  63. ;
  64. ; A value can be specified in the following ways:
  65. ; "text"              A literal text string
  66. ; VARNAME             The name of a variable
  67. ; VARNAME[start end]  A substring of a variable
  68. ; VARNAME[start]      A single character
  69. ; VARNAME+            Increments variable (see explanation below)
  70. ;
  71. ; Variable names can be up to 8 characters long.  You can create up to 100
  72. ; variables and literals (this number includes the predefined variables).
  73. ;
  74. ; Parse-O-Matic defines several predefined variables.  They are:
  75. ; $FLINE = The line just read from the file
  76. ; $FLUPC = The line just read from the file, in uppercase
  77. ; $BRL   = The { character (used in OUT)
  78. ; $BRR   = The } character (used in OUT)
  79. ;
  80. ;
  81. ; NOTE ABOUT DELIMITERS
  82. ; ---------------------
  83. ;
  84. ; If you have to specify a quotation mark, use "".  For example:
  85. ; IGNORE "He said ""Hello"" to me."
  86. ; This would ignore lines containing:  He said "Hello" to me.
  87. ;
  88. ;
  89. ; ILLEGAL CHARACTERS
  90. ; ------------------
  91. ;
  92. ; No command can contain the following ASCII characters:
  93. ; $00 (Null)  $0A (LF)  $0D (CR)
  94. ; Of course, LF and CR do appear at the very end of each line.
  95. ;
  96. ;
  97. ; INCREMENTING
  98. ; ------------
  99. ;
  100. ; Only numeric incrementing is supported at this time.  Attempting to
  101. ; increment another type of variable will result in an error.
  102. ;
  103. ; Incrementing "1" gives you "2"
  104. ; Incrementing "9" gives you "10"
  105. ;
  106. ;
  107. MINLEN "85"
  108. ;
  109. IGNORE $FLINE[ 01  08] "Date: "
  110. IGNORE $FLINE[ 49  67] "Order      Expected"
  111. IGNORE $FLINE[ 49  68] "Date       Ship Date"
  112. IGNORE $FLINE[ 10  32] "Item number/Description"
  113. ;
  114. ; Tidy up file line
  115. ;
  116. CHANGE $FLINE """" "'"
  117. ;
  118. ; Determine where we are
  119. ;
  120. IF     $FLINE[8] " " ITEMCNTR ITEMCNTR+ "0"
  121. ;
  122. ; Set variables
  123. ;
  124. IF     ITEMCNTR "0" REFNUM   $FLINE[  1   8]
  125. IF     ITEMCNTR "0" CUSTCODE $FLINE[ 10  15]
  126. IF     ITEMCNTR "0" CUSTDESC $FLINE[ 17  47]
  127. IF     ITEMCNTR "0" ORDRDATE $FLINE[ 49  57]
  128. IF     ITEMCNTR "0" MSTRCVDT $FLINE[ 60  68]
  129. IF     ITEMCNTR "1" PRICE    $FLINE[105 114]
  130. IF     ITEMCNTR "1" QTY      $FLINE[ 76  86]
  131. IF     ITEMCNTR "1" PARTNUM  $FLINE[ 10  32]
  132. IF     ITEMCNTR "2" DESCRIP  $FLINE[ 10  43]
  133. ;
  134. ; Tidy up variables
  135. ;
  136. TRIM   REFNUM   "B" " "
  137. TRIM   CUSTCODE "B" " "
  138. TRIM   CUSTDESC "B" " "
  139. TRIM   ORDRDATE "B" " "
  140. TRIM   MSTRCVDT "B" " "
  141. TRIM   PRICE    "B" " "
  142. TRIM   PRICE    "A" ","
  143. TRIM   QTY      "B" " "
  144. TRIM   PARTNUM  "B" " "
  145. TRIM   DESCRIP  "B" " "
  146. IF     PRICE    "" PRICE "0.00"
  147. IF     QTY      "" QTY   "0"
  148. ;
  149. ; Output
  150. ;
  151. OUT    ITEMCNTR "2" |"{REFNUM}","{CUSTCODE}","{CUSTDESC}","{ORDRDATE}",
  152. OUT    ITEMCNTR "2" |"{MSTRCVDT}",{PRICE},{QTY},"{PARTNUM}",
  153. OUTEND ITEMCNTR "2" |"{DESCRIP}"
  154. ;
  155. ; Reset item counter
  156. ;
  157. IF     ITEMCNTR "2" ITEMCNTR "0"
  158.